package com.lfz.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lfz.demo.entity.ChinaTotal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author lfz
 * @date 2025/2/28 17:29
 */
@Mapper
public interface ChinaTotalMapper extends BaseMapper<ChinaTotal> {

    // 查询近七次的全国人口普查数据
    @Select("select * from (select * from china_total order by update_time desc limit 7) as recent_data " +
            "order by update_time asc")
    List<ChinaTotal> findSevenTotalPopulation();
}
